<?php
/**
 * WAVESELF FRAMEWORK
 * 
 * Waveself framework is an open source project released under New BSD license.
 * Waveself Engine Team did this in order to help you as ourselves with different
 * but still easy to use and learn approach. 
 * 
 * Please read license before you do any changes or to say, before using current software
 * read our licence which can be found under waveself framework root folder.
 * 
 * If you did not recieve copy of licence, contact us immediately and we will send you copy.
 * 
 * @category   Waveself
 * @author     Nevio Vesic <nevio.vesic@gmail.com>
 * @copyright  Waveself Framework NPO 2009-2010
 * @license    https://code.google.com/p/waveself-framework/source/browse/trunk/LICENSE   New-BSD
 * @version    0.1a
 */

/**
 * Current component is base engine startup for complete framework.
 * It's not neccesarry to say anything else. In order to find out more
 * go to docs/index.html (from browser) and navigate yourself to engine section.
 * 
 * @category    Waveself
 * @package     Engine
 * @subpackage  Bootstrap
 * @author      Nevio Vesic <nevio.vesic@gmail.com>
 * @copyright   Waveself Framework NPO 2009-2010
 * @version     0.1 
 */
class Waveself_Engine_Bootstrap extends Waveself_Engine_Abstract
{
	/**
	 * Private, bootstrap connection to engine router
	 *
	 * @var NULL|Waveself_Engine_Router
	 */
	private $_router  = null;
	
	/**
	 * Private bootstrap connection to engine project
	 *
	 * @var NULL|Waveself_Engine_Project
	 */
	private $_project = null;
	
	/**
	 * Load router, project component in order to find project, controller
	 * and to load hooks, libraries and at last view.
	 */
	public function __construct()
	{
		/** Load Router */
		if (!isset(self::$_engineComponents['router'])) {
			self::$_engineComponents['router'] = new Waveself_Engine_Router();
		}
		$this->_router = $this->getRouter();
		
		/** Load Project */
		if (!isset(self::$_engineComponents['project'])) {
			self::$_engineComponents['project'] = new Waveself_Engine_Project();
		}
		$this->_project = $this->getProject();
		
	}
	
	/**
	 * Call project dispatcher after successfull preparations.
	 */
	public function bootstrap()
	{
		$this->_project->dispatch();
	}
	
}